<template>
	<view>
    <view class="list-container">
      <view class="item">
        <view class="top-label" @click="retractItem">
          <view>从业人员</view>
          <view v-if="viewItem.show"><uv-icon name="arrow-down" size="40rpx" color="#000000"></uv-icon></view>
          <view v-else><uv-icon name="arrow-right" size="40rpx" color="#000000"></uv-icon></view>
        </view>
        <view v-if="viewItem.show" class="info">
					<view class="table-head">
						<view>序号</view>
						<view>姓名</view>
						<view>性别</view>
						<view>发证日期</view>
						<view>健康证明</view>
					</view>
					<view v-for="(item, index) in list" :key="index" class="table-bottom" v-if="list && list.length > 0">
						<view>{{ index + 1 }}</view>
						<view>{{ item.name||"--" }}</view>
						<view>{{ item.sex=='1'?'女':'男' }}</view>
						<view>{{ item.cardStartDay||"--" }}</view>
						<view class="tabel-img"><image :src="item.firstImage"></image></view>
					</view>
					<view v-else class="tabel-no-data">
						<image src="@/static/image/noData.png" class="no-data"></image>
						<view>暂无数据</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
import {ref, reactive, defineProps,getCurrentInstance} from 'vue';
import publicAPI from "@/api/law/public/public";
import {onShow} from "@dcloudio/uni-app";
const {proxy} = getCurrentInstance();
const viewItem = reactive({ show: false });
const list = ref([]);
const props = defineProps({
  canteenId: {
    type: String,
    default: null
  }
});
let getEmployedList = async () => {
  let res = await proxy.http.asyncPost(publicAPI.getOrgEmployedNoTenantId, {pageSize:-1,pageNum: -1,orgId: props.canteenId});
  if (res.code === 0 ) {
    list.value = [...res.data.records];
  }else {
    await uni.showToast({title: res.msg, icon: 'none'});
  }
};

function retractItem() {
	viewItem.show = !viewItem.show;
}
onMounted(() => {
  console.log("获取从业人员信息")
  getEmployedList();
})
</script>

<style lang="scss" scoped>
@import '@/static/css/dailycheck/viewIndex.scss';
@import '@/static/css/dailycheck/common.scss';
</style>
